var f2hGetListInJson1 = function (adres, listName, fields, callback, query) {
var $ = jQuery;
if (fields == undefined)
fields = ['Title'];
if (query == undefined)
query = "";
var viewFields = "";
$.each(fields, function (k, v) {
viewFields += ""
});
$().SPServices({
operation: "GetListItems",
webURL: adres,
listName: listName,
async: false,
CAMLViewFields: "" + viewFields + "",
CAMLQuery: query,
CAMLRowLimit: 0,
completefunc: function (data, status) {
var error = $(data.responseXML).find('errorstring').text().trim();
var error_code = $(data.responseXML).find('errorcode').text().trim();
if (error_code == "0x82000006") {
alert("UWAGA. Lista '" + listName + "' nie została znaleziona. Nie można kontynuować.");
}
else if (error_code) {
alert("BŁĄD: " + error_code + "\n" + error);
return;
}
var result = [];
$(data.responseXML).find("z\\:row, row").each(function () {
var item = {};
var row = $(this);
$.each(fields, function (i, name) {
item[name] = row.attr('ows_' + name);
});
result.push(item);
});
if (callback)
callback(result, status);
}
});
};
var f2hGetListInJson2 = function (adres, listName, fields, callback, query, rowLimit) {
var $ = jQuery;
if (fields == undefined)
fields = ['Title'];
if (query == undefined)
query = "";
var viewFields = "";
$.each(fields, function (k, v) {
viewFields += ""
});
$().SPServices({
operation: "GetListItems",
webURL: adres,
listName: listName,
async: false,
CAMLViewFields: "" + viewFields + "",
CAMLQuery: query,
CAMLRowLimit: rowLimit,
completefunc: function (data, status) {
var error = $(data.responseXML).find('errorstring').text().trim();
var error_code = $(data.responseXML).find('errorcode').text().trim();
if (error_code == "0x82000006") {
alert("UWAGA. Lista '" + listName + "' nie została znaleziona. Nie można kontynuować.");
}
else if (error_code) {
alert("BŁĄD: " + error_code + "\n" + error);
return;
}
var result = [];
$(data.responseXML).find("z\\:row, row").each(function () {
var item = {};
var row = $(this);
$.each(fields, function (i, name) {
item[name] = row.attr('ows_' + name);
});
result.push(item);
});
if (callback)
callback(result, status);
}
});
};
jQuery(window).load(function() {
var link;
var path = window.location.protocol + "//" + window.location.host + _spPageContextInfo.webServerRelativeUrl;
f2hGetListInJson2("//" + window.location.host +"/DE" , "PopUps", [ 'PublishingRollupImage','Address','active','shadow','langversion'], function (data, status) {
if(data.length >0 && typeof data[0].langversion !== 'undefined' && path.indexOf("/"+data[0].langversion)> 1)
{
var opacity = "0.0";
if(data[0].shadow >0)
opacity = "0.7; background-color: #000;";
var shadow ='
';
jQuery('body').append(shadow );
var popupStr = "";
// var popupStr = data[0].PublishingRollupImage;
jQuery( "#visual" ).after(popupStr );
jQuery('#popUpDiv2').show();
var marginWidth = jQuery("#popUpDiv2 img").width();
jQuery("#popUpDiv2 img").load(function() {
jQuery("#popUpDiv2 img").css("margin-left","-"+ (this.width /2).toString() +"px");
});
//if(jQuery("#popUpDiv2 img").width() == 0)
//marginWidth = 900;
// jQuery("#popUpDiv2 img").css("margin-left","-"+ (marginWidth /2).toString() +"px");
if (typeof data[0].Address !== 'undefined') {
if(data[0].Address.indexOf("https://") < 0 && data[0].Address[0] != "/" )
link = "https://"+ data[0].Address;
else
link = data[0].Address;
}
}
}, "1", 1);
// HERE ADD TIMEOUT FADE OTUT
jQuery("#close, #shadow, #popUpDiv2").click(function(e){
jQuery("#popUpDiv2").fadeOut( "slow" );
jQuery("#shadow").fadeOut( "slow" );
e.stopPropagation();
});
jQuery("#popUpDiv2").click(function(){
if (typeof link !== 'undefined') {
window.open(link , '_blank');
}
});
});
/*
jQuery( document ).ready(function() {
var shadow ='';
jQuery('body').append(shadow );
var popupStr = '';
jQuery( ".grey_wrapper .main .container_4" ).before(popupStr );
jQuery('#popUpDiv').show();
jQuery("#close, #shadow, #popUpDiv").click(function(e){
jQuery("#popUpDiv").fadeOut( "slow" );
jQuery("#shadow").fadeOut( "slow" );
e.stopPropagation();
});
jQuery("#popUpDiv").click(function(){
window.open("http://qgaz.pl/#oferta", '_blank');
});
});
*/